<?php
include 'authenticate.php';
/* require_once ('Config.php');
require_once ('storage.php');
require_once ('authHelper.php');
require_once 'lib/googleapi/src/Google/Client.php';

$storage = new apiSessionStorage();


$authHelper = new AuthHelper($client, $storage, 'index.php');
if(isset($_GET['action'])) {
			
		$action=$_GET['action'];
		//echo $objectives;
	}
		else { 
			$action="";
						
		}
if(isset($_GET['code'])) {
			
		$code=$_GET['code'];
		//echo $objectives;
	}
		else { 
			$code="";
						
		}		
if ($action == 'revoke') {
$authHelper->revokeToken();

} else if ($action == 'auth' || $code) {
$authHelper->authenticate($code);

} else {
$authHelper->setTokenFromStorage();

if ($authHelper->isAuthorized()) {
$analytics = new Google_AnalyticsService($client);
$accounts = $analytics->management_accountSummaries->listManagementAccountSummaries();

/* if ($_GET['demo'] == 'hello') {

  // Hello Analytics API Demo.
  require_once 'helloAnalyticsApi.php';

  $demo = new HelloAnalyticsApi($analytics);
  $htmlOutput = $demo->getHtmlOutput();
  $demoError = $demo->getError();

} else if ($_GET['demo'] == 'mgmt') {

  // Management API Reference Demo.
  require_once 'managementApiReference.php';

  $demo = new ManagementApiReference($analytics);
  $htmlOutput = $demo->getHtmlOutput();
  $demoError = $demo->getError();

} else if ($_GET['demo'] == 'reporting') {

  // Core Reporting API Reference Demo.
  require_once 'CoreReportingApiReference.php';

  $demo = new coreReportingApiReference($analytics, THIS_PAGE);
  $htmlOutput = $demo->getHtmlOutput($_GET['tableId']);
  $demoError = $demo->getError();
} */
/* }

  // The PHP library will try to update the access token
  // (via the refresh token) when an API request is made.
  // So the actual token in apiClient can be different after
  // a require through Google_AnalyticsService is made. Here we
  // make sure whatever the valid token in $service is also
  // persisted into storage.
  $storage->set($client->getAccessToken());
} */ 
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
    <meta name="description" content="">
    <meta name="author" content="">
    

    <title>ALLEN ANALYTICS</title>

    <script src="js/jquery-1.11.1.js"></script>

    <!-- Bootstrap core CSS -->
	<script src="js/jquery-1.11.1.js"></script>
	
<script language="javascript" src="calendar/calendar.js"></script>
	<script src="js/jquery.tablesorter.js"></script>
	
	<script src="js/jquery.chained.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/jquery.chained.remote.js" type="text/javascript" charset="utf-8"></script>
	<script src="amcharts/amcharts.js" type="text/javascript"></script>
        <script src="amcharts/serial.js" type="text/javascript"></script>
		<script src="amcharts/pie.js" type="text/javascript"></script>
		
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
	

    <!-- Custom styles for this template -->
    <link href="css/navbar.css" rel="stylesheet">
	<link href="css/grid.css" rel="stylesheet">
	<link href="calendar/calendar.css" rel="stylesheet" type="text/css" />

	
    
  </head>
  <body>